package com.j.lemon.learn.basic;

import java.util.Arrays;

/**
 * @Author lijunjun
 * @Date 2019-04-16 12:02
 * @Description 方法参数传递：形参是基本数据类型时，实际参数传递的是数据值，
 *                          形参是引用数据类型时，实际参数传递的是地址值。
 */
public class ValueTransfer {
    public static void main(String[] args) {
        int i = 1;
        String str = "hello";
        Integer num = 200;
        int [] arr = {1,2,3,4,5};
        Mydata my = new Mydata();

        change(i,str,num,arr,my);

        System.out.println(i);
        System.out.println(str);
        System.out.println(Arrays.toString(arr));
        System.out.println(my.a);
    }

    public static void change(int j,String s ,Integer n,int [] a,Mydata m){
        j+=1;
        s+="word";
        n+=1;
        a[0]+=1;
        m.a+=1;
    }
}
class Mydata{
    int a = 10;
}
